#define  _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<math.h>
int isSquare(int num)
{
	int s = (int)sqrt(num);
	return s * s == num;
}
int main()
{
	int a, b;
	scanf("%d %d", &a, &b);
	for (int i = a; i <= b; i++)
	{
		if (isSquare(i))
		{
			int temp = i;
			int found = 1;
			while (temp > 0)
			{
				if (!isSquare(temp % 10))
				{
					found = 0;
					break;
				}
				temp /= 10;

			}
			if (found)
			{
				printf("%d\n", i);
			}
		}
	}
	return 0;
}